package com.briup;

import java.net.SocketTimeoutException;
import java.sql.SQLOutput;
import java.util.Scanner;

public class test3 {
    /*
    public static int setBit(int v, int n)
    {
        return v | (1 << n);
    }

    public static void main(String[] args) {
        int v = 5, n = 2;
        int result = setBit(v, n);
        System.out.println(result);
    }

     public static int setZero(int v, int n)
     {
         return v & ~(1 << n);
     }

    public static void main(String[] args) {
        int v = 5, n = 2;
        int result = setZero(v, n);
        System.out.println(result);
    }

    public static void main(String[] args) {
    int b = 5;
    if (b > 4)
        System.out.println(b);
    else
        b--;
    System.out.println(b);
}

    public static void main(String[] args) {
        int b = 5;
        if (b > 4) b--;
        System.out.println("b大于4");
        else
        {
            System.out.println("b不大于4");
        }
    }


    public static void main(String[] args) {
        int age = 45;
        if (age > 20)
            System.out.println("年轻人");
        else if (age > 40)
            System.out.println("中轻人");
        if (age > 60)
            System.out.println("老轻人");
    }


    public static void main(String[] args) {
        int a = 80;
        switch (a)
        {
            case 90:{
                System.out.println("优秀");
            }
            case 80:{
                System.out.println("一般");
            }
            case 60:{
                System.out.println("及格");
            }
            case 50:{
                System.out.println("基础弱");
            }
        }
    }

    public static void main(String[] args) {
        int count = 0;
        while (count > 0);
        {
            System.out.println(count);
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 5; i++)
        {
            System.out.print(i);
            i *= 0.1;
        }
        System.out.println("循环结束");
    }

    public static void main(String[] args) {
        for (int i = 0; i < 3; i++)
        {
            System.out.println(i);
            if (i == 1)
                continue;
            System.out.println("continue后的输出语句");
        }
    }

    public static void main(String[] args) {
        for (int i = 1; i <= 9; i++)
        {
            for (int j = 1; j <= i; j++)
            {
                System.out.print(i + "*" + j + "=" + (i * j) + "\t");
            }
            System.out.println();
        }
    }

    public static Boolean isPrime(int num)
    {
        for (int i = 2; i <= Math.sqrt(num); i++)
        {
            if (num % i == 0)
                return false;
        }
        return true;
    }

    public static void main(String[] args) {
        for (int i = 101; i <= 200; i++)
        {
            if (isPrime(i))
                System.out.print(i + " ");
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入月份:> ");
        int month = sc.nextInt();
        String season = "";
        switch (month)
        {
            case 1: case 12: case 2:
                season = "冬季";
                break;
            case 3: case 4: case 5:
                season = "春季";
                break;
            case 6: case 7: case 8:
                season = "夏季";
                break;
            case 9: case 10: case 11:
                season = "秋季";
                break;
        }
        if (month >=1 && month <= 12)
            System.out.print(month + "月是" + season);
        else
            System.out.print("输入月份错误");
    }

    public static boolean isLeapYear(int year) {
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
            return true;
        return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年月日:> ");
        int[] ymd = new int[3];
        for (int i = 0; i < ymd.length; i++)
            ymd[i] = sc.nextInt();
        int[] daysOfMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if (isLeapYear(ymd[0]))
            daysOfMonth[1] = 29;
        int sum = 0;
        for (int i = 0; i < ymd[1] - 1; i++)
            sum += daysOfMonth[i];
        sum += ymd[2];
        System.out.println(sum);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        System.out.println("输入一个数:> ");
        int num = sc.nextInt();
        for (int i = 1; i <= num / 2; i++)
        {
            if (num % i == 0)
                sum += i;
        }
        if (sum == num)
            System.out.println(num + "是完全数");
        else
            System.out.println(num + "不是完全数");
    }

    public static void main(String[] args) {
        int n = 4;
        for (int i = 1; i <= 4; i++)
        {
            for (int j = i; j < n; j++)
                System.out.print(" ");
            for (int k = 1; k <= (2 * i - 1); k++)
                System.out.print("*");
            System.out.println();
        }
        for (int i = n - 1; i >= 1; i--)
        {
            for (int j = n; j > i; j--)
                System.out.print(" ");
            for (int k = 1; k <= (2 * i - 1); k++)
                System.out.print("*");
            System.out.println();
        }
    }

     */
    public static Boolean isPrime(int num)
    {
        for (int i = 2; i <= Math.sqrt(num); i++)
        {
            if (num % i == 0)
                return false;
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入: ");
        int num = sc.nextInt();
        int[] prime = new int[10];
        if (isPrime(num))
            System.out.println(num + " = " + num);
        else
        {
            int tmp = num;
            for (int j = 2; j < tmp; j++)
            {
                if (isPrime(j))
                {
                    while (tmp % j == 0)
                    {
                        System.out.print(j + " * ");
                        tmp /= j;
                        if (isPrime(tmp))
                        {
                            System.out.print(tmp);
                            break;
                        }
                    }
                }
            }
            System.out.println();
        }
    }
}
